package com.douqu.game.core.config.activity;

import com.douqu.game.core.config.common.GoodsData;
import com.douqu.game.core.entity.GameObject;
import com.douqu.game.core.util.LoadUtils;
import com.douqu.game.core.util.LogUtils;
import com.douqu.game.core.util.time.TimeData;

/**
 * 活动大厅
 */
public class ActivityHallConfig extends GameObject {

    public int type;
    //系统id
    public int functionid;
    //触发时间
    public TimeData triggerTime;
    //展示时间
    //public TimeData showTime;
    //周历是否显示
    public int showWeek;

    @Override
    public boolean check() {
        if (functionid <= 0){
            LogUtils.error("ActivityHallConfig functionid error id :" + id + " valeu:" + functionid);
            return false;
        }
        if (triggerTime == null){
            LogUtils.error("ActivityHallConfig triggerTime is null id :" + id + " name:" + name);
            return false;
        }
        return super.check();
    }

    @Override
    public boolean setVariable(String key, String value) {
        if ("triggerTime".equals(key)){
            triggerTime = LoadUtils.loadTimeData(key,value);
            return true;
        }else
            return super.setVariable(key, value);
    }

    @Override
    public String toString() {
        return "ActivityHallConfig{" +
                "type=" + type +
                ", functionid=" + functionid +
                ", triggerTime=" + triggerTime +
                ", showWeek=" + showWeek +
                '}';
    }
}
